﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Kokomo.PeInspector.Reflection
{
	class InterfaceMethodMapping
	{
		public InterfaceMethodMapping(
			MethodInfo interfaceMethod,
			MethodInfo implementation
			)
		{
			this.InterfaceMethod = interfaceMethod;
			this.Implementation = implementation;
		}

		public MethodInfo InterfaceMethod { get; private set; }
		public MethodInfo Implementation { get; private set; }

		public static InterfaceMethodMapping[] FromInterfaceMapping(InterfaceMapping mapping)
		{
			InterfaceMethodMapping[] methodMappings = new InterfaceMethodMapping[mapping.InterfaceMethods.Length];
			for (int i = 0; i < mapping.InterfaceMethods.Length; i++)
			{
				methodMappings[i] = new InterfaceMethodMapping(mapping.InterfaceMethods[i], mapping.TargetMethods[i]);
			}
			return methodMappings;
		}
	}
}
